﻿using System;
using System.Web.UI.WebControls;
using BLL.RF.SourceCategory;

public partial class ViewbyProduct_ViewRFSourceData_ViewFRGYTestDatabySN : System.Web.UI.Page
{
    TemperatureCheck tc;

    public ViewbyProduct_ViewRFSourceData_ViewFRGYTestDatabySN()
    {
        tc = new TemperatureCheck();
    }

    protected void Page_Load(object sender, EventArgs e)
    {

    }

    protected void Button1_Click(object sender, EventArgs e)
    {
        string productSN = this.TextBox1.Text.Trim();
        productSN = CommHelper.GetProductSN(productSN);
        this.GV_TemperatrueCheck.DataSource = tc.TemperatureCheck_GetbyProductSN(productSN);
        this.GV_TemperatrueCheck.DataBind();
    }

    protected void GV_TemperatrueCheck_RowDataBound(object sender, GridViewRowEventArgs e)
    {
        if (e.Row.RowType == DataControlRowType.DataRow)
        {
            //if (e.Row.Cells[6].Text == "True")
            if ((bool)GV_TemperatrueCheck.DataKeys[e.Row.RowIndex].Values[2] == true)
            {
                e.Row.Cells[5].Text = "Pass";
            }
            else
            {
                e.Row.Cells[5].Text = "Fail";
                e.Row.Cells[5].ForeColor = System.Drawing.Color.Red;
            }
        }
    }
}
